package com.oocl.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.oocl.entity.OrderComment;
import com.oocl.service.OrderCommentService;
import com.oocl.vo.OrderCommentVo;
import com.oocl.vo.OrderCommentVo1;

@Controller
@RequestMapping("/ordersComments")
public class OrdersCommentsController {
	@Resource(name="ordersCommentService")
	private OrderCommentService orderCommentService;
	
	
	@RequestMapping(value="/findall",method=RequestMethod.GET)
	@ResponseBody
	public List<OrderCommentVo1> findCommentsByMerchant(HttpSession session){
		return orderCommentService.findAllOrderComments((String)session.getAttribute("icnum"));
	}
	
	@RequestMapping(value="/findbystatus",method=RequestMethod.GET)
	@ResponseBody
	public List<OrderCommentVo1> findCommentsByMerchantWithStatus(String status, HttpSession session){
		return orderCommentService.findBystatuswithIcnum((String)session.getAttribute("icnum"),status );
	}
	
	
	@RequestMapping(value="/replyOrderComment",method=RequestMethod.GET)
	@ResponseBody
	public OrderCommentVo replyOrderComment(String id,String reply){	
		return orderCommentService.replyOrderComment(id, reply);
		
	}
	
	@RequestMapping(value="/findordercommentByoid",method=RequestMethod.GET)
	@ResponseBody
	public OrderCommentVo1 replyOrderComment(String oid){	
		return orderCommentService.findCommentVoByoid(oid);
		
	}

}
